<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=899166509d1c7898bbad044a910bffa0"></script>
	<title>位置导航</title>
	<style>
		body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
	</style>
</head>
<body>
	<div id="allmap"></div>
	<div class="over"></div>
	<script>
		function init(){
			getLocation();
		}
		window.onload = init;
		
		function getLocation() {

			var geolocation = new BMap.Geolocation();
			geolocation.getCurrentPosition(function(r){
			    if(this.getStatus() == BMAP_STATUS_SUCCESS){
			    	var latitude = 113.371;
			    	var longitude = 23.133;
			        
					latitude = r.point.lat;
					longitude = r.point.lng;
					// 百度地图API功能
					var map = new BMap.Map("allmap");
					var begin = new BMap.Point(longitude, latitude);
					var end = new BMap.Point(113.422365, 23.125607);
					map.centerAndZoom(begin, 14);
					
					var driving = new BMap.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}});
					driving.search(begin, end);
			    }
			    else {
			        alert('failed'+this.getStatus());
			    }        
			},{enableHighAccuracy: true})
		}
		
		document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
			WeixinJSBridge.call('hideOptionMenu');
		});
		
		
	</script>
</body>
</html>